home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
suncom.zip
/
SUNINC.INC
< prev
next >
Wrap
Text File
|
1990-02-24
|
17KB
|
538 lines
(************************************************************************)
PROCEDURE Line(LineChr,
LineLength,
Color : Integer);
VAR Counter : Integer;
begin
textcolor(Color);
for Counter := 1 to LineLength do
begin
write(chr(LineChr));
end;
end;
(****************************************************************************)
FUNCTION ReadPause : Boolean;
VAR x,y : Integer;
Question : Char;
LABEL Beginning;
begin
while keypressed do
begin
X := whereX;
Y := whereY;
SETSCREEN(lightred+blink,black,0,65,1,79,1);
OFFCURSOR;
write('FILE PAUSED.');
Beginning:
Question := ReadKey;
if Question = #27
then begin
READPAUSE := TRUE;
exit;
end;
if Question <> #13 then goto Beginning;
ONCURSOR;
SETSCREEN(white,black,0,65,1,79,1);
SETSCREEN(white,black,1,1,2,79,25);
gotoxy(X,Y);
READPAUSE := FALSE;
end;
end;
(*****************************************************************************)
PROCEDURE LIST_TO_PRINTER(FileName : String);
CONST
PageWidth = 80;
PrintLength = 55;
PathLength = 65;
FormFeed = #12;
VerticalTabLength = 3;
TYPE
WorkString = String[126];
VAR
CurRow : Integer;
MainFile : Text;
{---------------------------------------------------------------------------}
PROCEDURE VerticalTab;
VAR i: integer;
begin
for i := 1 to VerticalTabLength do Writeln(LST);
end {vertical tab};
{---------------------------------------------------------------------------}
PROCEDURE ProcessLine(PrintStr: WorkString);
begin
CurRow := Succ(CurRow);
if Length(PrintStr) > PageWidth then Inc(CurRow);
if CurRow > PrintLength then
begin
Write(LST,FormFeed);
VerticalTab;
CurRow := 1;
end;
Writeln(LST,PrintStr);
end {Process line};
{---------------------------------------------------------------------------}
PROCEDURE ProcessFile(FileName : string);
{ This procedure displays the contents of the File to the Printer }
VAR
LineBuffer: WorkString;
begin {Process File}
VerticalTab;
while not EOF(mainfile) do
begin
Readln(MainFile,LineBuffer);
ProcessLine(LineBuffer);
if READPAUSE = TRUE then Exit;
end;
Close(MainFile);
Write(LST,FormFeed); { move the printer to the beginning of the next }
{ page }
end {Process File};
{---------------------------------------------------------------------------}
begin {List_To_Printer}
CurRow := 0;
assign(MainFile,FileName);
reset(MainFile);
ProcessFile(FileName);
end; {List_To_Printer}
(****************************************************************************)
PROCEDURE Read_File(VAR Config : ConfigRec);
VAR Source : String;
Chars,
Mode,
Question : Char;
DataFile : File of Char;
Modem,
dbool : Boolean;
begin
WINDOWIN(white,blue,4,10,10,70,12,CursorCol,CursorRow,WindowPtr);
textcolor(yellow);
write(' Read Filename: ');
textcolor(white);
readln(Source);
if length(Source) = 0 then
begin
WINDOWOUT(CursorCol,CursorRow,WindowPtr);
exit;
end;
textcolor(yellow);
SETSCREEN(black,black,0,10,10,70,12);
MAKEWINDOW(white,blue,4,0,25,10,55,16);
OFFCURSOR;
textcolor(yellow);
writeln(' Select Display Device');
LINE(196,29,white);
textcolor(yellow);
writeln(' S - Screen ');
writeln(' P - Printer');
write(' M - Modem ');
Mode := ReadKey;
Mode := UpCase(Mode);
ONCURSOR;
if not(Mode in ['M','P'])
then Mode := 'S';
if Mode = 'M'
then Modem := True
else Modem := False;
SETSCREEN(white,black,0,1,1,80,25);
SETSCREEN(white,black,0,1,1,80,1);
write('Printing File: ');
textcolor(yellow);
write(Source);
textcolor(white);
write(' Mode: ');
textcolor(yellow);
case Mode of
'M' : write('Modem ');
'S' : write('Screen ');
'P' : write('Printer');
end; {case}
SETSCREEN(white,black,0,1,2,80,25);
write('Press ENTER when Ready or ESC to Exit.');
Question := readkey;
if Question = #27 then
begin
WINDOWOUT(CursorCol,CursorRow,WindowPtr);
exit;
end;
clrscr;
assign(DataFile,Source);
{$I-}
reset(DataFile);
{$I+}
if IOResult <> 0 then
begin
MAKEWINDOW(yellow,red,4,0,31,11,49,13);
textcolor(white+blink);
OFFCURSOR;
write(' File Not Found!',^G);
repeat until KeyPressed;
ONCURSOR;
WINDOWOUT(CursorCol,CursorRow,WindowPtr);
exit;
end;
if Mode = 'P'
then begin
LIST_TO_PRINTER(Source);
SETSCREEN(red,white,0,1,1,80,1);
write(' Printing Completed. Press Any Key.');
Question := readkey;
WINDOWOUT(CursorCol,CursorRow,WindowPtr);
exit;
end;
while not eof(DataFile) do
begin
read(DataFile,Chars);
ANSIDRIVER(Chars);
if Modem = True
then begin
Async_Send(Chars);
delay(10);
end;
if READPAUSE = True
then begin
WINDOWOUT(CursorCol,CursorRow,WindowPtr);
exit;
end;
end;
close(DataFile);
SETSCREEN(red,white,0,1,1,80,1);
write(' Printing Completed. Press Any Key.');
Question := readkey;
WINDOWOUT(CursorCol,CursorRow,WindowPtr);
end;
(****************************************************************************)
PROCEDURE ReturnBeep(VAR Config : ConfigRec);
VAR Lcv : Byte;
begin
Lcv := 0;
if Config.MuteMode = Off
then
repeat
Sound(500);
delay(50);
Sound(1000);
delay(50);
Lcv := Lcv + 1;
until KeyPressed or (Lcv = 30);
nosound;
end;
(************************************************************************)
(* Hex_To_Dec --- Convert hex string to decimal number *)
(************************************************************************)
FUNCTION Hex_To_Dec( S : AnyStr; Default : Integer ) : Integer;
(************************************************************************)
(* *)
(* Function: Hex_To_Dec *)
(* *)
(* Purpose: Convert hex string to decimal number *)
(* *)
(* Calling Sequence: *)
(* *)
(* Integ := Hex_To_Dec( S: AnyStr; Default: Integer ) : Integer; *)
(* *)
(* S --- the hex string *)
(* Default --- value to return if S not hex string *)
(* Integ --- corresponding decimal Integer (0 if bad) *)
(* *)
(**********************